<?php
/**
 * Author: Thu Bach
 * Created: 20141029
 * Description: this is a class for attributes
 */	
 
 class Attributes extends \Phalcon\Mvc\Collection
 {
 	/*
	 * Members
	 */
 	public $Description;
	public $EntityCode;
	public $View;
	public $Attribute;
	public $Modifier;
	public $ModifiedDate;
	
	/*
	 * Methods
	 */
	 
	/*
	* Get all attribute of Entity
	* Last update: 20141115
	* Author: Thu Bach
	*/
	public function getAttributeEntity($entity)
	{
		$attributes = Attributes::find(
			array(array("EntityCode"=>$entity),
				"sort"=>array("View"=>1)
			)
		);
		return $attributes;
	}
	 
	/*
    * Goal: Get all attribute base on Entity and view
	* Last Update: 20141115
	* Author: Thu Bach
	*/
	public function getAttributeEntityView($entity, $view)
	{
		$attributes = Attributes::find(
			array(array("EntityCode"=>$entity, "View"=>$view),
				"sort"=>array("View"=>1)
			)
		);
		return $attributes;
	}
	  
 }
